home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_kdelibs.idb / usr / freeware / kde / include / kfilesimpleview.h.z / kfilesimpleview.h
Encoding:
C/C++ Source or Header  |  1999-01-26  |  2.4 KB  |  75 lines

  1. // -*- c++ -*-
  2. /* This file is part of the KDE libraries
  3.     Copyright (C) 1997 Stephan Kulow <coolo@kde.org>
  4.  
  5.     This library is free software; you can redistribute it and/or
  6.     modify it under the terms of the GNU Library General Public
  7.     License as published by the Free Software Foundation; either
  8.     version 2 of the License, or (at your option) any later version.
  9.  
  10.     This library is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  13.     Library General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU Library General Public License
  16.     along with this library; see the file COPYING.LIB.  If not, write to
  17.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  18.     Boston, MA 02111-1307, USA.
  19. */
  20.  
  21. #ifndef KFILESIMPLEVIEW_H
  22. #define KFILESIMPLEVIEW_H
  23.  
  24. class KFileInfo;
  25. class QWidget;
  26.  
  27. #include <qtablevw.h>
  28. #include <qpixmap.h>
  29. #include "kfileinfocontents.h"
  30.  
  31. class KFileSimpleView : public QTableView, public KFileInfoContents {
  32.     Q_OBJECT
  33.  
  34. public:
  35.     KFileSimpleView(bool s, QDir::SortSpec sorting, QWidget *parent, const char *name);
  36.     virtual ~KFileSimpleView();
  37.     
  38.     virtual QWidget *widget() { return this; }
  39.     virtual void setAutoUpdate(bool);
  40.     virtual void clearView();
  41.     
  42.     virtual bool acceptsFiles() { return true; }
  43.     virtual bool acceptsDirs() { return true; }
  44.  
  45. protected:
  46.     virtual void highlightItem(unsigned int item);
  47.     virtual bool insertItem(const KFileInfo *i, int index);
  48.     virtual void paintCell( QPainter *, int, int);
  49.     virtual void resizeEvent ( QResizeEvent *e );
  50.     virtual void keyPressEvent( QKeyEvent* e );
  51.     virtual int  cellWidth ( int col );
  52.     virtual void mousePressEvent( QMouseEvent* e );
  53.     virtual void mouseDoubleClickEvent ( QMouseEvent *e );
  54.     virtual void focusInEvent ( QFocusEvent * );
  55.     virtual void focusOutEvent ( QFocusEvent * );
  56.  
  57.     void highlightItem(int row, int col);
  58.  
  59.     /* own function, which calls QTableView::setNumCols */
  60.     void setNumCols(int i);
  61.     
  62.     int rowsVisible;
  63.     int curCol, curRow;
  64.     int *cellWidths;
  65.     QList<QPixmap> pixmaps;
  66.     // this flag is used for speed up, when autoUpdate is false
  67.     bool touched;
  68.     uint *width_array;
  69.     uint width_length;
  70.     uint width_max;
  71.     void insertArray(uint item, uint pos);
  72. };
  73.  
  74. #endif // KFILESIMPLEVIEW_H
  75.